package com.anti_poverty_detection_system.springboot.mapper;

import com.anti_poverty_detection_system.springboot.model.IdentificationCodes;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ZITONG BAI
 * @since 2024-06-17
 */
public interface IdentificationCodesMapper extends BaseMapper<IdentificationCodes> {
    @Select("<script>" +
            "SELECT * FROM identification_codes " +
            "<where>" +
            "<if test='keywords != null and keywords != &quot;&quot;'>" +
            "AND (region LIKE CONCAT('%', #{keywords}, '%')) " +
            "</if>" +
            "</where>" +
            "</script>")
    Page<IdentificationCodes> selectSearchIdentificationCodes(Page<IdentificationCodes> identificationCodesPage, @Param("keywords") String keywords);
}
